﻿/*********************************************************************************
 *Author:         OnClick
 *Version:        1.0
 *UnityVersion:   2018.3.11f1
 *Date:           2019-04-15
 *Description:    IFramework
 *History:        2018.11--
*********************************************************************************/
using System.Collections.Generic;
using UnityEngine;

namespace IFramework
{
    public class ABCollectWindow : IEditorGUI
    {
        public static List<ABCollectViewItem> colletors = new List<ABCollectViewItem>();
        private ABCollectWindowLeftMenu leftMunu = new ABCollectWindowLeftMenu();
        private ABCollectWindowListview  list = new ABCollectWindowListview ();
        private ABCollectWindowBottom buttom = new ABCollectWindowBottom();
        public override void OnEnable()
        {
            base.OnEnable();
            colletors.Clear();
            colletors.AddRange(ABCollectInfoIO.Load());
        }

        public override void OnGUI(Rect rect, Rect worldRect)
        {
            base.OnGUI(rect, worldRect);
            DrawArea(() => {
                leftMunu.OnGUI(new Rect(0, 0, 200, rect.height),
                    new Rect(worldRect.x, worldRect.y, 200, rect.height));
                RightTop(new Rect(200, 0, rect.width - 200, 20));
                list.OnGUI(new Rect(200, 20, rect.width - 200, rect.height - 140),
                    new Rect(worldRect.x+ 200,worldRect.y+ 20, rect.width - 200, rect.height - 140));
                buttom.OnGUI(new Rect(200, rect.height - 120, rect.width - 200, 120),
                    new Rect(worldRect.x+ 200,worldRect.y+ rect.height - 120, rect.width - 200, 120));
            }, rect);
        }
        private void RightTop(Rect rect)
        {
            DrawArea(() => {
                DrawHorizontal(() =>
                {
                    Space(30);
                    Label("ABCollectType", Width(rect.width / 8));
                    Label("SearchOption", Width(rect.width / 7));
                    Label("SearchPattern", Width(rect.width / 8));
                    Label("SearchPath",Width(rect.width / 3));
                    Label("BundleName");
                });
            },
            rect);
        }
    }

}
